package org.heka.imageproc_forfun;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.StreamCorruptedException;

import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;


public class ListLoad  extends ListActivity {
	
	
	private static final int GROUPNUM = 10; 
	
	private static final int RESULT_COMPLETE = 100;
	
	String[] items;
	
	
	
	private ArrayAdapter<String> groupAdapter;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        
        setContentView(R.layout.list_load);        
        
        //setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,items));
        
        items = new String[GROUPNUM];        
     
        updateGroupNameList();
        
		groupAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,items);
		
        setListAdapter(groupAdapter);
        
        this.getListView().setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				final int selected = arg2;
				
				Intent intent = new Intent();
				intent.putExtra("list_category", selected+200);
				ListLoad.this.setResult(RESULT_COMPLETE, intent);
				ListLoad.this.finish();
			}
		});
    }
    
    private void updateGroupNameList(){
    	items[0] = "기본효과";
    	items[1] = "마스크";
    	items[2] = "수염";
    	items[3] = "안경";
    	items[4] = "모자";
    	items[5] = "스폐셜";
    	items[6] = "모자이크";
    	items[7] = "때리기";
    	items[8] = "전투력측정";
    	items[9] = "랜덤";    	
    }   
}
